package com.meetingshow.weibo.service;

import java.util.ArrayList;
import java.util.List;

import com.meetingshow.common.base.dao.model.QueryStruct;
import com.meetingshow.common.base.service.BaseServiceImp;
import com.meetingshow.common.base.service.model.QueryResults;
import com.meetingshow.weibo.dao.WeiboDAO;
import com.meetingshow.weibo.dao.model.WeiboPO;
import com.meetingshow.weibo.service.model.WeiboQueryParas;
import com.meetingshow.weibo.service.util.WeiboQueryParasBuilder;
import com.meetingshow.weibo.service.util.WeiboServiceParas;

public class WeiboServiceImp extends BaseServiceImp implements IWeiboService {


    private WeiboDAO weiboDAO;
    
    /**
     * @return the weiboDAO
     */
    public WeiboDAO getWeiboDAO() {
        return weiboDAO;
    }

    /**
     * @param weiboDAO the weiboDAO to set
     */
    public void setWeiboDAO(WeiboDAO weiboDAO) {
        this.weiboDAO = weiboDAO;
    }

    @Override
    public Integer saveWeibo(WeiboPO weiboPO) throws Exception {
        return getWeiboDAO().saveWeibo(weiboPO);
    }

    @Override
    public void updateWeibo(WeiboPO weiboPO) throws Exception {
        getWeiboDAO().updateWeibo(weiboPO);
    }

    @Override
    public void removeWeibo(WeiboPO weiboPO) throws Exception {
        getWeiboDAO().removeWeibo(weiboPO);
    }

    @Override
    public WeiboPO loadWeiboById(Integer weiboId) throws Exception {
        return getWeiboDAO().loadWeiboById(weiboId);
    }
    
    @Override
    public QueryResults<WeiboPO> queryWeibo(
            WeiboQueryParas weiboQueryParas) throws Exception {
        QueryStruct queryStruct = new QueryStruct();
        List<String> tableList = new ArrayList<String>();
        List<String> returnObjectList = new ArrayList<String>();
        
        tableList.add(WeiboServiceParas.WEIBO_PO);
        returnObjectList.add(WeiboServiceParas.WEIBO_PO);
        
        queryStruct.setTableList(tableList);
        queryStruct.setReturnObjectList(returnObjectList);
        
        queryStruct = WeiboQueryParasBuilder.weiboQueryBuilder(queryStruct, weiboQueryParas);
        QueryResults<WeiboPO> queryResults = getWeiboDAO().queryWeibo(queryStruct);
        return queryResults;
    }


}
